package com.leet.code.lcof;

public class Code53_2 {

    public static void main(String[] args) {
        int[] nums = {1};
        System.out.println(new Code53_2().missingNumber(nums));

    }

    public int missingNumber(int[] nums) {

        int start = 0;
        int end = nums.length - 1;
        int mid;
        while (start <= end) {
            mid = start + (end - start) / 2;
            if (nums[mid] == mid) {
                start = mid + 1;
            } else {
                end = mid - 1;
            }
        }
        return start;

    }

}
